<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-menu
        :default-openeds="['1', '3']"
        router
        :default-active="activePath"
      >
        <el-menu-item-group>
          <el-menu-item index="1-1">个人资料</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="2">
          <template slot="title"><i class="el-icon-menu"></i>单词本</template>
          <el-menu-item-group>
            <template slot="title">四级单词</template>
            <el-menu-item
              :index="'/' + 'cet4Word'"
              @click="saveNavState('/' + 'cet4Word')"
              >四级单词</el-menu-item
            >
          </el-menu-item-group>
          <el-menu-item-group title="六级单词">
            <el-menu-item
              :index="'/' + 'cet6Word'"
              @click="saveNavState('/' + 'cet6Word')"
              >六级单词</el-menu-item
            >
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title"
            ><i class="el-icon-setting"></i>学习进度</template
          >
          <el-menu-item-group>
            <template slot="title">阅览记录</template>
            <el-menu-item index="3-1">杂志</el-menu-item>
            <el-menu-item index="3-2">影视</el-menu-item>
          </el-menu-item-group>
          <el-menu-item-group title="单词量记录">
            <el-menu-item index="3-3">熟悉单词</el-menu-item>
            <el-menu-item index="3-4">掌握单词</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header>
        <div class="left">
          <el-button class="all-degree">全部单词</el-button>
          <el-button class="unfamiliar" type="info">陌生单词</el-button>
          <el-button class="familiar" type="primary">熟悉单词</el-button>
          <el-button class="grasp" type="success">掌握单词</el-button>
        </div>
        <div class="center"></div>
        <div class="right">
          <router-link to="/" style="padding: 10px">返回首页</router-link>
          <el-dropdown>
            <i
              class="iconfont icon-character-avatar"
              style="margin-right: 15px"
            ></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>好友列表</el-dropdown-item>
              <el-dropdown-item>Vip特权</el-dropdown-item>
              <el-dropdown-item>切换账号</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <span>李小猪</span>
        </div>
      </el-header>

      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    const item = {
      date: "2020-11-21",
      name: "李小猪",
      address: "移通学院",
    };
    return {
      tableData: Array(20).fill(item),
      activePath: "",
    };
  },
  methods: {
    saveNavState(activePath) {
      console.log(activePath);
      window.sessionStorage.setItem("activePath", activePath);
      this.activePath = activePath;
    },
  },
};
</script>

<style>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
  font-size: 17px;
  display: flex;
  align-items: center;
  
}
.left {
  width: 450px;
  flex: 0 0 450px;
}
.center {
  flex: 1 1 auto;
}
.right {
  width: 300px;
  flex: 0 0 300px;
}
.el-aside {
  color: #333;
}
.el-button {
  color: black;
}
/* .unfamiliar {
  background-color: #e4d9d9;
  color: #fff;
}
.familiar {
  background: #cdd8c8;
  color: #fff;
}
.grasp {
  background-color: rgb(178, 233, 95);
  color: #fff;
} */
</style>
